<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/11/20 12:17
 */

namespace App\Transformers\Api;

use App\Models\MedicalRecord;
use League\Fractal\TransformerAbstract;

class MedicalRecordTransformer extends TransformerAbstract
{
    public function transform(MedicalRecord $record)
    {
        return [
            'id'          => $record->id,
            'clinic_at'   => $record->clinic_at,
            'visit_type'  => $record->visit_type,
            'is_western'  => $record->is_western,
            'doctor_id'   => $record->doctor_id,
            'patient_id'  => $record->patient_id,
            'hospital_id' => $record->hospital_id,
            'created_at'  => $record->created_at->toDateTimeString(),
            'updated_at'  => $record->updated_at->toDateTimeString(),
        ];
    }

}